package com.example.demo.controller;

import com.example.demo.pojo.Result;
import com.example.demo.pojo.entity.UserDiet;
import com.example.demo.service.DietService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/polycystic/diet")
public class DietController {
    @Autowired
    private DietService dietService;

    @GetMapping()
    public Result<List<UserDiet>> getDiet(){
        List<UserDiet> userDietList=dietService.getDiet();
        return Result.success(userDietList);
    }

    @GetMapping("/finish/{id}")
    public Result finish(@PathVariable Long id){
        dietService.finish(id);
        return Result.success();
    }
}
